function [TotalPower,powerspec]=DenoiseSpec(chunk,chunkEmpty, FFTSize)

if ( length(chunk)>6000)
    disp('asd');
end
spec=(fft(chunk,FFTSize));
%emptyspec=(fft(chunkEmpty,FFTSize));

spec=abs(spec(1:round(end/2)));
%emptyspec=smooth(abs(emptyspec(1:round(end/2))),3);
%emptyspec=abs(emptyspec(1:round(end/2))) + mean( spec(round(end/2):end) );
% figure(1)
% plot(spec(1:300));
% hold all
% plot(emptyspec(1:300));


%spec=spec./(emptyspec);

p=sum(spec);
%plot(100*spec(1:300));
%hold off;

spec=spec.^2;
%emptyspec=(conj(emptyspec).*emptyspec);

%spec=spec./(emptyspec+spec+.0001);%.05);

%spec = spec.* ( (1:length(spec)) .^.5)';

spec(1)=0;
%spec(2)=0;

TotalPower  = sum(spec(1:end))^.25;

powerspec=(spec./p)*1000;%.^.5;

end